package com.azdebugit.list.arraylist.test.option;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class CollectionsListDemo {
    public static void main(String[] args) {

        List<String> list = new ArrayList<String>();
        list.add("aa");
        list.add("bb");

        System.out.println("初始化前: " + list);

        //实现 unmodifiable
        List<String> immutablelist = Collections.unmodifiableList(list);

        //修改 list
        immutablelist.add("zz");
    }
}